--SELECT * FROM cat_jobalert
--DELETE FROM cat_jobalert
INSERT INTO cat_jobalert
SELECT
case len(convert(varchar(10),id))
    when 6 then '00000000-0000-0000-0000-000000' + convert(varchar(10),id)
    when 5 then '00000000-0000-0000-0000-0000000' + convert(varchar(10),id) 
    when 4 then '00000000-0000-0000-0000-00000000' + convert(varchar(10),id) 
    when 3 then '00000000-0000-0000-0000-000000000' + convert(varchar(10),id) 
    when 2 then '00000000-0000-0000-0000-0000000000' + convert(varchar(10),id) 
    when 1 then '00000000-0000-0000-0000-00000000000'+ convert(varchar(10),id) 
    end As Id,SEARCHERNAME AS [Name],left(wantindustry,7) AS [IndustryCode],left(wantjobclass,7) +'00' AS [CategoryCode1],left(wantjobclass,9)  AS [CategoryCode2],JobAddDate AS [PostedDuration],Experience AS [YearsOfService],SalaryComm AS [SalaryRange],CompanyChar AS [CompanyType],Educational AS [EducationLevel],PositionChar AS [JobType],OrderWebJob AS [Frequency],JobCount AS [Deliveries],'00000000-0000-0000-0000-00000' + convert(varchar(7),Userid) AS  [JobseekerId],Recivemail AS [Email],case searcherflagwhen 0 then 1when 1 then 0 else 0 end AS [IsSubscribed],0 AS [IsRecommended],updateddate AS [LastSerached],createddate AS [DateCreated],updateddate AS [LastUpdated]FROM srv_lnk.nchr2008.dbo.PersonSearcher
WHERE userid in (select right(id,7) from cat_jobseeker)




--SELECT TOP 10 * FROM srv_lnk.nchr2008.dbo.PersonSearcher where createddate >='2012-10-10'
